<div class="panel panel-success">
    <div class="panel-heading">
        <div class="panel-title">
            日志详情
        </div>

    </div>
    <div class="panel-body" id="log_content">
        加载中...
    </div>
    <div class="panel-footer">
        <a href="#" onclick="storeLog()" style="margin-right: 40px">日志归档</a>
        <a href="#" onclick="genLog()" style="margin-right: 40px">更多</a>
    </div>

</div>
<script type="application/javascript">
    var logName='{{.Body.logName}}';
    var logType='{{.Body.logType}}';
    var start=0;
    var length=0;
    function genLog() {
        $.ajax({
            url: "/logInfo",
            data: $.toJSON({name:logName,type:logType,start:start}),
            type: 'POST',
            dataType: "JSON",
            success: function(data){
                if(data.code==0&&data.data.length>0){
                    length+=data.data.length;
                    if(start==0){
                        $("#log_content").html("");
                    }
                    $("#log_content").append(data.data.data);
                    start+=data.data.length;
                }else{
                    parent.layer.msg(data.msg);
                }

            }
        })
    }
    function storeLog() {
        layer.msg('确定确定存档‘'+logName+'’的日志？', {
            time: 0 //不自动关闭
            ,btn: ['确定', '取消']
            ,yes: function(index){
                $.ajax({
                    url: "/storeLog",
                    data: $.toJSON({name:logName,type:logType,length:length}),
                    type: 'POST',
                    dataType: "JSON",
                    success: function(data){
                    console.log(data)
                        if(data.code==0){
                            parent.location.reload(true)
                        }else{
                            parent.layer.msg(data.msg);
                        }

                    }
                })
            }
        });

    }
    $(function(){
        genLog();
    });
</script>